<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Document</title>
</head>
<body>
    <form method='post' action='/resign'>
        <p>
            <input type='email' name='email' id="email" placeholder='请输入邮箱...' required/>
            <button type="button" onclick="getCode()">获取验证码</button>
        </p>
        <p>
            <input type='text' name='pass' placeholder='验证码' />
        </p>
        <p>
            <input type='password' name='passwd' placeholder='密码'/>

        </p>
        <button type="submit">
            立即注册
        </button>
        <li>注册即同意《用户协议》</li>
    </form>
</body>
<script>
    function getCode(){
        var mail = document.getElementById('email');
        console.log('mail',mail.value);
        var url = 'http://148.70.223.218:3001/resign/email';
        fetch(url,{
            method:'POST',
            body:mail.value
        }).then(res=>res.json())
        .then(res=>{
            console.log('res',res)
        })

        // fetch('http://localhost:3001/resign/confirm',{
        //     method:'POST',
        //     mode:'cors',
        //     headers:{
        //         'Content-Type':"application/x-www-form-urlencoded"
        //     },
        //     body:`utel=${tel}`
        // }).then(res=>res.json())
        // .then(json=>{console.log(json)})
    }
</script>
</html>
